package com.study_online.service.Impl;

import com.study_online.domain.ForumType;
import com.study_online.domain.ResultInfo;
import com.study_online.mapper.ForumTypeMapper;
import com.study_online.service.ForumTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ForumTypeServiceImpl implements ForumTypeService {

    @Autowired
    private ForumTypeMapper forumTypeMapper;

    @Override
    public ResultInfo findAllForumByType() {

        ResultInfo info = new ResultInfo();
        info.setFlag(true);
        try {
            List<ForumType> all = forumTypeMapper.findAllForumByType();
            info.setData(all);

        } catch (Exception e) {
            info.setFlag(false);
            info.setErrorInfo("查询专区下的帖子失败！");
            e.printStackTrace();
        }

        return info;
    }
}
